<template>
  <div style="width: 100%">
    <a-card :bordered="false">
      <a-table
      ref="table"
      size="default"
      rowKey="key"
      :columns="columns"
      :loading="loading"
      :dataSource="data"
      :pagination="false"
    >

      <span slot="serial" slot-scope="text, record, index">
        {{ index + 1 }}
      </span>
    </a-table>
    </a-card>
  </div>
</template>

<script>
import { STable } from '~'

export default {
  name: 'Online',
  components: {
    STable
  },
  data () {
    return {
      loading: false,
      data: [],
      // 表头
      columns: [
        {
          title: '序号',
          scopedSlots: { customRender: 'serial' }
        },
        {
          title: '院系代码',
          dataIndex: 'yxdm'
        },
        {
          title: '院系',
          dataIndex: 'yx'
        },
        {
          title: '专业代码',
          dataIndex: 'zydm'
        },
        {
          title: '专业名称',
          dataIndex: 'zymc'
        },
        {
          title: '报名人数',
          dataIndex: 'bmrs'
        },
        {
          title: '上线人数(不包括推免生)',
          dataIndex: 'ssrs'
        }
      ]
    }
  },
  created () {
    this.loadData()
  },
  methods: {
    // 加载数据
    loadData () {
      return new Promise(resolve => { resolve() }).then(res => {
        this.data = [{
          yxdm: 'yxdm',
          yx: '工程院',
          zydm: 'zydm',
          zymc: '计算机',
          bmrs: '100',
          ssrs: '100',
          key: 1
        }, {
          yxdm: 'yxdm',
          yx: '工程院',
          zydm: 'zydm',
          bmrs: '100',
          zymc: '计算机',
          ssrs: '100',
          key: 13
        }, {
          yxdm: 'yxdm',
          yx: '工程院',
          zymc: '计算机',
          zydm: 'zydm',
          bmrs: '100',
          ssrs: '100',
          key: 16
        }]
      })
    }
  }
}
</script>
